
class sdl_exception final : std::exception
{
	std::string w;

public:
	sdl_exception(char* format, ...);
	virtual const char* what() const override
	{
		return w.c_str();
	}
};

class vlc_window final
{
	libvlc_instance_t *libvlc;
	libvlc_media_t *m;
	libvlc_media_player_t *mp;
	int action;
	int displayNumber;

    SDL_Renderer *renderer;
    SDL_Texture *texture;
    SDL_mutex *mutex;

	// Callbacks from libvlc_video_set_callbacks
	static void* lock(void* data, void** pixels);
	static void  unlock(void* data, void* id, void* const* pixels);
	static void  display(void* data, void* id);

	int MYEVT_PLAY;
	int MYEVT_LOAD;
	int MYEVT_PAUSE;
	int MYEVT_STOP;
	int MYEVT_CLS;
	int MYEVT_TEST;

public:
	void do_clearscreen();
	void do_load(const char* filename);
	void do_play();
	void do_pause();
	void do_stop();

public:
	vlc_window(int display);
	~vlc_window();
	bool messageloop_step();

	void clearscreen();
	void load(const char* filename);
	void play();
	void pause();
	void stop();
	void test();
};